<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <comp-a></comp-a>
        <!-- <comp-a></comp-a>
        <comp-a></comp-a>
        <comp-a></comp-a> -->
        <hr>
        <comp-b></comp-b>
    </div>
    <template id="temp">
        <div>
            <h3>组件B</h3>
            <p>msg：{{msg}}</p>
            <input type="text" v-model="msg">
            <input type="button" value="show" @click="show()">
            <comp-a></comp-a>
        </div>
    </template>
</body>
<script>
    var Comp = Vue.extend({
        template:"<h1>info:{{info}}</h1>",
        data(){
            return {
                info:"Comp的页面模板"
            };
        },
        beforeCreate() {
            console.log("Comp组件实例被创建");
        },

    });

    Vue.component("CompA",Comp);

    Vue.component("CompB",{
        template:"#temp",
        data(){
            return {
                msg:"默认数据"
            }
        },
        methods: {
            show(){
                alert(1111);
            }
        },  

    });

    new Vue({
        el:"#app"
    });
</script>
</html>